using System.Collections;
using System.Collections.Generic;
using Assets.Common.Unity;
using UnityEngine;

#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
using UnityEngine.InputSystem;
#endif

// public class UnityInput : MonoBehaviour,IUnityInput
// {
//  
// }

public class UnityInputUtil : IUnityInput
{
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
    public Vector2 MousePosition => Mouse.current.position.ReadValue();

    public bool MouseLeftButtonPressed => Mouse.current.leftButton.isPressed;
    public bool MouseLeftButtonWasPressedThisFrame => Mouse.current.leftButton.wasPressedThisFrame;
    public bool MouseRightButtonPressed => Mouse.current.rightButton.isPressed;
    public bool MouseRightButtonWasPressedThisFrame => Mouse.current.rightButton.wasPressedThisFrame;
    public bool KeyWasPressThisFrame(KeyCode keyCode) => 
        Keyboard.current[InputSystemUtil.KeyCode2Key(keyCode)]
        .wasPressedThisFrame;
#else
    public Vector2 MousePosition => return Input.mousePosition;
    public bool MouseLeftButtonPressed => Input.GetMouseButton(0);
#endif
}